export

abstract suspend fun export(block: DesignBlock, mimeType: MimeType, options: ExportOptions? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): ByteBuffer

Exports a design block element as a file of the given mime type. Performs an internal update to resolve the final layout for the blocks. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

Return

the exported data.

Parameters

block

the design block element to export.

mimeType

the mime type of the output file.

options

the options for exporting the block type

onPreExport

the lambda to configure the engine before export. This lambda is called on a background thread, and the Engine parameter of this lambda is a separate engine instance running in that background thread.

uriResolver

optional async resolution function that accepts both relative and absolute uri and returns an absolute uri.


abstract suspend fun export(blocks: List<DesignBlock>, mimeType: MimeType, options: ExportOptions? = null, onPreExport: suspend Engine.() -> Unit = {}, uriResolver: suspend (Uri) -> Uri? = null): List<ByteBuffer>

Exports multiple design block elements as files of the given mime type. Performs an internal update to resolve the final layout for the blocks. This method is more memory efficient than calling export repeatedly for multiple blocks as it reuses a single worker engine for all exports. Note: The export happens in a background thread and the Engine instance in the onPreExport lambda is a separate instance and is alive until the suspending function resumes. Use this lambda to configure the background engine for export. If uriResolver is provided it will be set on the background engine before the exported scene is loaded and once more after onPreExport is invoked (so it takes precedence if onPreExport also sets a resolver).

Return

the exported data for each block, in the same order as the input blocks.

Parameters

blocks

the design block elements to export.

mimeType

the mime type of the output files.

options

the options for exporting the block type

onPreExport

the lambda to configure the engine before export. This lambda is called on a background thread, and the Engine parameter of this lambda is a separate engine instance running in that background thread.

uriResolver

optional async resolution function that accepts both relative and absolute uri and returns an absolute uri.